﻿using LanguageDetector;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace LanguageDetector.Tests
{
    
    
    /// <summary>
    ///This is a test class for LanguageDetectorTest and is intended
    ///to contain all LanguageDetectorTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LanguageDetectorTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Detect
        ///</summary>
        [TestMethod()]
        public void DetectTest()
        {
            string result = string.Empty;

            bool isUnknownsFound = false;


            result = ChracterSetDetector.Detect("abcd");
            result = ChracterSetDetector.Detect("ಸೌಂದರ್ಯ");
            result = ChracterSetDetector.Detect("वीकेंड मैगजीन: IPL Spot Fixing, विंदू, बॉलीवुड और बदनामी!");
            result = ChracterSetDetector.Detect("சுஷ்மிதா");
            result = ChracterSetDetector.Detect("காலவரையற்ற வேலை நிறுத்தப் போராட்டத்தில் குதிக்கும் 17,500 என்எல்சி ஊழியர்கள்");
            result = ChracterSetDetector.Detect("సహజత్వానికి దగ్గరగా ఉండే 'పరదేశి'");
            result = ChracterSetDetector.Detect("ರೂಪಾಯಿ ಮೌಲ್ಯ ಕುಸಿತದಿಂದ ಉದ್ಯಮಗಳು ಸಂಕಷ್ಟದಲ್ಲಿ");
            result = ChracterSetDetector.Detect("ജെസീന്തയുടെ ആത്മഹത്യാക്കുറിപ്പില്‍ ആശുപത്രി ജീവനക്കാര്‍ക്ക് വിമര്‍ശനം");
            result = ChracterSetDetector.Detect("റോളര്‍സ്‌കേറ്റിംഗ്‌ ടീമിനെ പ്രഖ്യാപിച്ചു");
            result = ChracterSetDetector.Detect("જામનગરમાં AIR FORCEનું વિમાન તૂટી પડ્યું");
            result = ChracterSetDetector.Detect("ગુજરાતની ITIમાં 10000 બેઠકો વધારાશે : સૌરભ પટેલ");
            result = ChracterSetDetector.Detect("'Ritz'ની લાઇફલાઇન વધારશે '@buzZ'", out isUnknownsFound);
            result = ChracterSetDetector.Detect("���� ����� ������", out isUnknownsFound);

            var isvalid = IsInvalidCharsFound("��� ����� sdasdfa");



            return;

            LanguageDetector target = new LanguageDetector();

            string text = "सलाद का मजा गर्मियों में";
            
            var actual = target.Detect(text);
        }

        private bool IsInvalidCharsFound(string inputString)
        {
            bool isUnknownOrInvalidCharsFoundInString = false;

            string resultedLanguage = ChracterSetDetector.Detect(inputString, out isUnknownOrInvalidCharsFoundInString);

            return isUnknownOrInvalidCharsFoundInString;
        }
        /// <summary>
        ///A test for LanguageDetector Constructor
        ///</summary>
        [TestMethod()]
        public void LanguageDetectorConstructorTest()
        {
            LanguageDetector target = new LanguageDetector();
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        /// <summary>
        ///A test for GetLanguageNameByCode
        ///</summary>
        [TestMethod()]
        public void GetLanguageNameByCodeTest()
        {
            LanguageDetector target = new LanguageDetector(); // TODO: Initialize to an appropriate value
            string code = string.Empty; // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            actual = target.GetLanguageNameByCode(code);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void BinaryToIntegerTest()
        {

            string binaryString = "200";

            int result = Convert.ToInt32(binaryString, 10);

            
            


        }

    }
}
